package com.bwie.doctor.controller;

import com.bwie.common.core.domain.Result;
import com.bwie.doctor.domain.po.MedRegistered;
import com.bwie.doctor.service.MedRegisteredService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cache.annotation.CacheConfig;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping
@CacheConfig
public class MedRegisteredController {
    @Autowired
    private MedRegisteredService medRegisteredService;

    /**
     * 取消挂号状态
     * @param realName
     * @param patientName
     * @return
     */
    @PostMapping("/registered/{realName}/{patientName}")
    public Result cancelDoctorState(@PathVariable String realName, @PathVariable String patientName)
    {
        medRegisteredService.cancelDoctorState(realName,patientName);
        return Result.success();
    }



    /**
     * 新增挂号
     */
    @PostMapping("/register/{dockerName}/{patientName}")
    public Result registered(@PathVariable String dockerName,@PathVariable String patientName)
    {
        medRegisteredService.register(dockerName,patientName);
        return Result.success();
    }

    /**
     * 查询患者挂号
     */
    @GetMapping("/registerdFindByi/{realName}")
    public Result<MedRegistered> registerdFindByi(@PathVariable String realName)
        {
            MedRegistered medRegistered = medRegisteredService.registerdFindByi(realName);
            return Result.success(medRegistered);
        }
}
